package com.kancy.kie.server.client.properties;

import java.time.Duration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * DroolsProperties
 * <p>
 *
 * @author: kancy
 * @date: 2020/3/12 15:13
 **/
public class DroolsKieServerProperties {
    private static final String USER = "kieserver";
    private static final String PASSWORD = "kieserver1!";
    /**
     * kie server node
     * ip:port
     */
    private String[] nodes = new String[]{"127.0.0.1:8080"};
    /**
     * 用户名
     */
    private String username = USER;
    /**
     * 密码
     */
    private String password = PASSWORD;

    /**
     * 超时时间，默认10秒
     */
    private Duration timeout = Duration.ofSeconds(10);

    /**
     * 当调用结果返回失败是否重试
     */
    private boolean failureRetry;

    /**
     * 最大重试次数
     */
    private int maxRetry = 1;

    /**
     * 请求头
     */
    private Map<String, String> headers = new HashMap<>();

    /**
     * 额外类型
     */
    private Set<Class<?>> extraClasses = new HashSet<>();

    public String[] getNodes() {
        return nodes;
    }

    public void setNodes(String[] nodes) {
        this.nodes = nodes;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Duration getTimeout() {
        return timeout;
    }

    public void setTimeout(Duration timeout) {
        this.timeout = timeout;
    }

    public Map<String, String> getHeaders() {
        return headers;
    }

    public void setHeaders(Map<String, String> headers) {
        this.headers = headers;
    }

    public Set<Class<?>> getExtraClasses() {
        return extraClasses;
    }

    public void setExtraClasses(Set<Class<?>> extraClasses) {
        this.extraClasses = extraClasses;
    }

    public int getMaxRetry() {
        return maxRetry;
    }

    public void setMaxRetry(int maxRetry) {
        this.maxRetry = maxRetry;
    }

    public boolean isFailureRetry() {
        return failureRetry;
    }

    public void setFailureRetry(boolean failureRetry) {
        this.failureRetry = failureRetry;
    }
}
